import request from '@/utils/request'


export default {
    //1.添加课程信息
    addCourseInfo(courseInfo) {
        return request({
            url: `/eduservice/course/addCourseInfo`,
            method: 'post',
            data: courseInfo,  //佳哥，这里是对象，没有引号
            // headers: {
            //     'Content-Type': 'application/json;charset=utf-8'
            // }
        })
    },
    //2.查询所有讲师
    getListTeacher() {
        return request({
            url: `/eduservice/teacher/findall`,
            method: 'get'
        })
    },
    //根据课程id查询课程基本信息
    getCourseInfoId(id) {
        return request({
            url: '/eduservice/course/getCourseInfo/' + id,
            method: 'get'
        })
    },
    //修改课程信息
    updateCourseInfo(courseInfo) {
        return request({
            url: '/eduservice/course/updateCourseInfo',
            method: 'post',
            data: courseInfo
        })
    },
    //课程确认信息显示
    getPublihCourseInfo(id) {
        return request({
            url: '/eduservice/course/getPublishCourseInfo/' + id,
            method: 'get'
        })
    },
    //课程最终发布
    publihCourse(id) {
        return request({
            url: '/eduservice/course/publishCourse/' + id,
            method: 'post'
        })
    },
    //TODO 课程列表带分页
    getCourseListPage(page,limit,courseQuery) {
        return request({
            url: `/eduservice/course/pageCourseCondition/${page}/${limit}`,
            method: 'post',
            data: courseQuery
        })
    },
    //删除课程
    deleteCourse(courseId){
        return request({
            url: '/eduservice/course/'+courseId,
            method: 'delete'
        })
    }
}

